package 天梯赛;

import java.util.Scanner;

public class 试试手气 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int [] arr=new int[6];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=scanner.nextInt();
        }
        int a1=arr[0];
        int a2=arr[1];
        int a3=arr[2];
        int a4=arr[3];
        int a5=arr[4];
        int a6=arr[5];
        int n=scanner.nextInt();//摇的次数
        int j=0;
        while (j++ < n) {
            for (int i = 0; i < arr.length; i++) {
                if (j == 1) {
                    if (arr[i] == 1 || arr[i] == 2 || arr[i] == 3 || arr[i] == 4 || arr[i] == 5) {
                        arr[i] = 6;
                    } else if (arr[i] == 6) {
                        arr[i] = 5;
                    }
                }
                if (j>1){
                    arr[i]--;
                    if (arr[0]==a1){
                        arr[0]--;
                    }if (arr[1]==a2) {
                        arr[1]--;
                    }if (arr[2]==a3){
                        arr[2]--;
                    }if (arr[3]==a4){
                        arr[3]--;
                    }if (arr[4]==a5){
                        arr[4]--;
                    }if (arr[5]==a6){
                        arr[5]--;
                    }
                }
            }
        }
            System.out.println(arr[0]+" "+arr[1]+" "+arr[2]+" "+arr[3]+" "+arr[4]+" "+arr[5]);
    }
}
